package cn.MaySoon.zhuansheng;

import me.clip.placeholderapi.external.EZPlaceholderHook;
import org.bukkit.entity.Player;

public class PAPIHooker extends EZPlaceholderHook {

    public PAPIHooker(main plugin){
        super(plugin, "zhuansheng");
    }
    @Override
    public String onPlaceholderRequest(Player player, String string) {
        String Placeholder = "";

        if (string.equals("xiuwei"))
        {
            Placeholder = main.PlayerZhaunSheng.get(player).getXiuwei()+"";
        }

        if (string.equalsIgnoreCase("needxiuwei")){
            Placeholder = handle.getUplevelNeedXiuwei(player)+"";
        }
        if (string.equalsIgnoreCase("level")){
            Placeholder = main.PlayerZhaunSheng.get(player).getLevel()+"";
        }

        if (string.equalsIgnoreCase("canbuyxiuwei")){
            Placeholder =handle.canbuyxiuweidan(player)+"";
        }
        if (string.equalsIgnoreCase("canbuydaxiuwei")){
            Placeholder =handle.canbuydaxiuweidan(player)+"";
        }
        if (string.equalsIgnoreCase("canexchangexiuwei")){
            Placeholder =handle.canexchangexiuwei(player)+"";
        }
        if (string.equalsIgnoreCase("ap-gongji")){
                if (main.PlayerAttribute.get(player).attributeValue.containsKey("物理伤害")){
                    Placeholder = main.PlayerAttribute.get(player).attributeValue.get("物理伤害")[0].intValue()+"";
                }
                else{
                    Placeholder = "0";
                }
        }
        if (string.equalsIgnoreCase("ap-fangyu")){
            if (main.PlayerAttribute.get(player).attributeValue.containsKey("物理防御")){
                Placeholder = main.PlayerAttribute.get(player).attributeValue.get("物理防御")[0].intValue()+"";
            }
            else{
                Placeholder = "0";
            }
        }
        if (string.equalsIgnoreCase("ap-shengming")){
            if (main.PlayerAttribute.get(player).attributeValue.containsKey("生命上限")){
                Placeholder = main.PlayerAttribute.get(player).attributeValue.get("生命上限")[0].intValue()+"";
            }
            else{
                Placeholder = "0";
            }

        }
        if (string.equalsIgnoreCase("ap-shanbi")){
            if (main.PlayerAttribute.get(player).attributeValue.containsKey("闪避")){
                Placeholder = main.PlayerAttribute.get(player).attributeValue.get("闪避")[0].intValue()+"";
            }
            else{
                Placeholder = "0";
            }
        }
        if (string.equalsIgnoreCase("ap-mingzhong")){
            if (main.PlayerAttribute.get(player).attributeValue.containsKey("命中")){
                Placeholder = main.PlayerAttribute.get(player).attributeValue.get("命中")[0].intValue()+"";
            }
            else{
                Placeholder = "0";
            }
        }
        if (string.equalsIgnoreCase("ap-baoji")){
            if (main.PlayerAttribute.get(player).attributeValue.containsKey("暴击")){
                Placeholder = main.PlayerAttribute.get(player).attributeValue.get("暴击")[0].intValue()+"";
            }
            else{
                Placeholder = "0";
            }
        }
        if (string.equalsIgnoreCase("ap-kangbao")){
            if (main.PlayerAttribute.get(player).attributeValue.containsKey("抗暴")){
                Placeholder = main.PlayerAttribute.get(player).attributeValue.get("抗暴")[0].intValue()+"";
            }
            else{
                Placeholder = "0";
            }
        }
        if (string.equalsIgnoreCase("ap-zhanli")){

                Double zhanli  = main.PlayerAttribute.get(player).getCombatPower();
                Placeholder =zhanli.intValue()+"";
        }





        return Placeholder;
    }

}
